Repository navigation
fix(codegen-ts): remove EFAULT-prone recursive rm from gen temp cleanup - #628
Merged
Merged
Conversation
…smiss - local-ci notify-send -u normal (was critical, never auto-dismissed) - codegen-ts: per-run/test temp dirs under $DEV_SCRATCH; race-safe removeTree falls back to a manual walk on Bun's intermittent rm EFAULT - integration-tests report-views-sqlite: DB in scratch and synchronous=OFF; setup fsync made each test ~1.3s, past the 5s timeout under disk load
…hange. One contributor-rule edit in CONTRIBUTING.md; no other stale facts found.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
codegen-tsrunGennow deletes its untracked gen-state dir through a newsrc/scratch-dir.tshelper (removeTree) instead of Bun's recursivermSync. The helper walks the tree withreaddir/unlink/rmdirand treats an already-missing path as success. Its per-run temp dir honorsDEV_SCRATCHviascratchRoot(). The codegen-ts tests that create temp dirs now usemakeScratchDir/removeTree, andCONTRIBUTING.mdsays new codegen-ts tests should do the same.integration-testsreport-views-sqlite.test.tsputs its throwaway SQLite database underDEV_SCRATCHwhen set, setsPRAGMA synchronous = OFFfor it, and uses a local walk-based remover in place ofrmSync.local-ci.ymlnotify job switchesnotify-sendfrom-u criticalto-u normal, so the "local-ci FAILED" desktop popup auto-dismisses. The GitHub email notification is unchanged.Validation
Risk Assessment
✅ Low: Change is test-infrastructure and CI-notification only. The one src change swaps tmpdir()/rmSync for a scratch helper with a readdir/unlink/rmdir walker that treats ENOENT as success. Each intent item is covered: notify-send is now
-u normal, the EFAULT rm sites go throughremoveTree, and the sqlite convergence test moves its DB to RAM withsynchronous=OFF.Testing
Both changes exercised; overall result pass. The workflow change ran the real extracted notify step and real notify-send on a private bus with a disposable notification daemon: the shipped step sends urgency normal and the pre-fix step sends critical. The flaky-test fix passed all affected codegen-ts and report-views-sqlite tests, including 12 parallel stress runs, and the removeTree adversarial checks passed. Not verified here: the GitHub email, which fires on the GitHub side, and reproduction of the original EFAULT/timeout on the base commit, since the race is intermittent and was not reproduced in this run. Broad regression came from the configured test command
scripts/ci-local.sh --affected --strict-toolchains, which passed at target 858ba00.|| echofallback keeps the job green in either case. Verifying needs a real failed run on GitHub Actions and the…Evidence: Recorded Notify D-Bus calls: shipped step urgency=1, pre-fix critical urgency=2
Evidence: Workflow notify step as shipped (run on private bus)
Evidence: Pre-fix notify step with -u critical (contrast)
Evidence: Disposable notification daemon used for the live urgency check
Evidence: removeTree adversarial run output
Evidence: Stress run summary (8x codegen-ts, 4x report-views-sqlite)
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
|| echofallback keeps the job green in either case. Verifying needs a real failed run on GitHub Actions and the…scripts/ci-local.sh --affected --strict-toolchainsBaseline (not re-run):scripts/ci-local.sh --affected --strict-toolchainspassed at target 858ba00a6e.Extracted thenotifyjob step from.github/workflows/local-ci.ymlwith yq/python and ran it with realnotify-sendon a private dbus-daemon session bus (/mnt/scratch/notify-live-2834449/bus.sock). The bus address was pointed at the private bus; the rest of the step ran as shipped.Disposable notification daemonfake_notifyd.py(dbus-py) on the private bus recorded Notify calls. Shipped step gave urgency=1; the pre-fix-u criticalvariant gave urgency=2.bun test packages/codegen-ts/test/scratch-dir.test.ts packages/codegen-ts/test/run-gen.test.ts packages/codegen-ts/test/package-layout-root-declared.test.ts packages/codegen-ts/test/vo-only-config-optional.test.ts(28 pass, 0 fail), run from server/typescript.bun test packages/integration-tests/test/report-views-sqlite.test.ts(22 pass, 0 fail).Stress: 8 parallel runs of the codegen-ts set and 4 parallel runs of report-views-sqlite, all exit 0 (summary in stress-summary.txt).Adversarial: ranremoveTree/makeScratchDir/scratchRootfrom codegen-ts/src/scratch-dir.ts in Bun against a populated tree with a symlink to an outside dir, a repeated removal of an absent path, and a DEV_SCRATCH-rooted scratch dir. Output in removetree-adversarial.out.Cleanup: stopped the private dbus-daemon, dbus-monitor and fake notification daemon by process group. Removed run scratch dir.git statusclean.Side effect disclosed: on the first attempt, the fake notification daemon ran without DBUS_SESSION_BUS_ADDRESS set and attached to the operator's real session bus for a few seconds. I stopped it by process group, and the rerun used only the private bus. No real notification was sent by the test steps.CONTRIBUTING.md:93- CONTRIBUTING.md: added a paragraph that codegen-ts tests needing temp dirs use makeScratchDir/removeTree from src/scratch-dir.ts, not mkdtempSync and rmSync recursive, because Bun's recursive rmSync can EFAULT under parallel load. Done.CHANGELOG.md- No CHANGELOG [Unreleased] entry added. The runGen temp-location change is internal (only visible when DEV_SCRATCH is set) and the test/CI fixes are not user-facing. Judgment call; add one if the maintainer wants the flake fix recorded.🔧 Fix applied.
1 info still open:
server/typescript/packages/codegen-ts/test- Raw mkdtempSync and recursive rmSync remain in about 537 sites across about 130 codegen-ts test, src and script files. The user-chosen migration to makeScratchDir/removeTree is code and test work, outside the docs-only phase. Scope is much larger than the 120-line / 20-file estimate. Not done here.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.